home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
xtartan-2.0
/
actions.c
next >
Wrap
C/C++ Source or Header
|
1995-05-24
|
2KB
|
145 lines
/* actions.c - translation table stuff and action routines for xtartan
* by Jim McBeath (jimmc@hisoft.uucp)
*
* 25.Oct.89 jimmc Initial definition
* 9.Jan.91 jimmc v2.0: Use XTartan resource file
*/
#include <X11/Intrinsic.h>
#include <stdio.h>
extern char *GetStringResource();
extern Widget TTopWidget;
extern char *TartanName;
extern char *TartanSett;
static void
Help(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
char *s;
s = GetStringResource(TTopWidget,"helpString");
if (s) {
(void)printf("%s",s);
XtFree(s);
} else {
(void)printf("No help available\n");
}
}
static void
SetTart(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
if (*argcp>0)
(void)setTartan(argv[0]);
}
static void
PrintName(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
(void)printf("%s\n", TartanName);
}
static void
PrintSettAction(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
PrintSett();
}
static void
DoExit(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
exit(0);
}
static void
Info(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
(void)printf("%s scale=%d linewidth=%d\n",
TartanName,getScale(),getWidth());
}
static void
Scale(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
if (*argcp>0)
changeScale(argv[0]);
else
changeScale("2"); /* default */
}
static void
LineWidth(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
if (*argcp>0)
changeWidth(argv[0]);
else
changeWidth("1"); /* default */
}
static void
Dump(w,xev,argv,argcp)
Widget w;
XEvent *xev;
String *argv;
int *argcp;
{
(void)printf("Tartan setts:\n");
DumpTartans();
(void)printf("Color codes in cache:\n");
dumpColors();
}
XtActionsRec actions[] = {
{"dump", Dump },
{"exit", DoExit },
{"help", Help },
{"info", Info },
{"lineWidth", LineWidth },
{"name", PrintName },
{"scale", Scale },
{"setTartan", SetTart },
{"sett", PrintSettAction },
};
initActions(appctx)
XtAppContext appctx;
{
XtAppAddActions(appctx,actions,XtNumber(actions));
}
/* end */